home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / Dialogs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  18.0 KB  |  554 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Dialogs.h
  3.  
  4.      Contains:    Dialog Manager interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1985-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __DIALOGS__
  19. #define __DIALOGS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __MIXEDMODE__
  25. #include <MixedMode.h>
  26. #endif
  27. #ifndef __EVENTS__
  28. #include <Events.h>
  29. #endif
  30. #ifndef __MACWINDOWS__
  31. #include <MacWindows.h>
  32. #endif
  33. #ifndef __TEXTEDIT__
  34. #include <TextEdit.h>
  35. #endif
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59.  
  60. enum {
  61.                                                                 /* new, more standard names for dialog item types*/
  62.     kControlDialogItem            = 4,
  63.     kButtonDialogItem            = kControlDialogItem | 0,
  64.     kCheckBoxDialogItem            = kControlDialogItem | 1,
  65.     kRadioButtonDialogItem        = kControlDialogItem | 2,
  66.     kResourceControlDialogItem    = kControlDialogItem | 3,
  67.     kStaticTextDialogItem        = 8,
  68.     kEditTextDialogItem            = 16,
  69.     kIconDialogItem                = 32,
  70.     kPictureDialogItem            = 64,
  71.     kUserDialogItem                = 0,
  72.     kItemDisableBit                = 128
  73. };
  74.  
  75.  
  76. enum {
  77.                                                                 /* old names for dialog item types*/
  78.     ctrlItem                    = 4,
  79.     btnCtrl                        = 0,
  80.     chkCtrl                        = 1,
  81.     radCtrl                        = 2,
  82.     resCtrl                        = 3,
  83.     statText                    = 8,
  84.     editText                    = 16,
  85.     iconItem                    = 32,
  86.     picItem                        = 64,
  87.     userItem                    = 0,
  88.     itemDisable                    = 128
  89. };
  90.  
  91.  
  92. enum {
  93.                                                                 /* standard dialog item numbers*/
  94.     kStdOkItemIndex                = 1,
  95.     kStdCancelItemIndex            = 2,                            /* old names*/
  96.     ok                            = kStdOkItemIndex,
  97.     cancel                        = kStdCancelItemIndex
  98. };
  99.  
  100.  
  101. enum {
  102.                                                                 /* standard icon resource id's     */
  103.     kStopIcon                    = 0,
  104.     kNoteIcon                    = 1,
  105.     kCautionIcon                = 2,                            /* old names*/
  106.     stopIcon                    = kStopIcon,
  107.     noteIcon                    = kNoteIcon,
  108.     cautionIcon                    = kCautionIcon
  109. };
  110.  
  111.  
  112.  
  113. #if OLDROUTINENAMES
  114. /*
  115.    These constants lived briefly on ETO 16.  They suggest
  116.    that there is only one index you can use for the OK 
  117.    item, which is not true.  You can put the ok item 
  118.    anywhere you want in the DITL.
  119. */
  120.  
  121. enum {
  122.     kOkItemIndex                = 1,
  123.     kCancelItemIndex            = 2
  124. };
  125.  
  126. #endif  /* OLDROUTINENAMES */
  127.  
  128. /*    Dialog Item List Manipulation Constants    */
  129. typedef SInt16                             DITLMethod;
  130.  
  131. enum {
  132.     overlayDITL                    = 0,
  133.     appendDITLRight                = 1,
  134.     appendDITLBottom            = 2
  135. };
  136.  
  137. typedef SInt16                             StageList;
  138. /* DialogRef is obsolete. Use DialogPtr instead.*/
  139. typedef DialogPtr                         DialogRef;
  140. struct DialogRecord {
  141.     WindowRecord                     window;
  142.     Handle                             items;
  143.     TEHandle                         textH;
  144.     SInt16                             editField;
  145.     SInt16                             editOpen;
  146.     SInt16                             aDefItem;
  147. };
  148. typedef struct DialogRecord DialogRecord;
  149.  
  150. typedef DialogRecord *                    DialogPeek;
  151. struct DialogTemplate {
  152.     Rect                             boundsRect;
  153.     SInt16                             procID;
  154.     Boolean                         visible;
  155.     Boolean                         filler1;
  156.     Boolean                         goAwayFlag;
  157.     Boolean                         filler2;
  158.     SInt32                             refCon;
  159.     SInt16                             itemsID;
  160.     Str255                             title;
  161. };
  162. typedef struct DialogTemplate DialogTemplate;
  163.  
  164. typedef DialogTemplate *                DialogTPtr;
  165. typedef DialogTPtr *                    DialogTHndl;
  166. struct AlertTemplate {
  167.     Rect                             boundsRect;
  168.     SInt16                             itemsID;
  169.     StageList                         stages;
  170. };
  171. typedef struct AlertTemplate AlertTemplate;
  172.  
  173. typedef AlertTemplate *                    AlertTPtr;
  174. typedef AlertTPtr *                        AlertTHndl;
  175. /* new type abstractions for the dialog manager */
  176. typedef SInt16                             DialogItemIndexZeroBased;
  177. typedef SInt16                             DialogItemIndex;
  178. typedef SInt16                             DialogItemType;
  179. /* dialog manager callbacks */
  180. typedef CALLBACK_API( void , SoundProcPtr )(SInt16 soundNumber);
  181. typedef CALLBACK_API( Boolean , ModalFilterProcPtr )(DialogPtr theDialog, EventRecord *theEvent, DialogItemIndex *itemHit);
  182. typedef CALLBACK_API( void , UserItemProcPtr )(WindowPtr theWindow, DialogItemIndex itemNo);
  183. typedef STACK_UPP_TYPE(SoundProcPtr)                             SoundUPP;
  184. typedef STACK_UPP_TYPE(ModalFilterProcPtr)                         ModalFilterUPP;
  185. typedef STACK_UPP_TYPE(UserItemProcPtr)                         UserItemUPP;
  186. enum { uppSoundProcInfo = 0x00000080 };                         /* pascal no_return_value Func(2_bytes) */
  187. enum { uppModalFilterProcInfo = 0x00000FD0 };                     /* pascal 1_byte Func(4_bytes, 4_bytes, 4_bytes) */
  188. enum { uppUserItemProcInfo = 0x000002C0 };                         /* pascal no_return_value Func(4_bytes, 2_bytes) */
  189. #define NewSoundProc(userRoutine)                                 (SoundUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSoundProcInfo, GetCurrentArchitecture())
  190. #define NewModalFilterProc(userRoutine)                         (ModalFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppModalFilterProcInfo, GetCurrentArchitecture())
  191. #define NewUserItemProc(userRoutine)                             (UserItemUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppUserItemProcInfo, GetCurrentArchitecture())
  192. #define CallSoundProc(userRoutine, soundNumber)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppSoundProcInfo, (soundNumber))
  193. #define CallModalFilterProc(userRoutine, theDialog, theEvent, itemHit)  CALL_THREE_PARAMETER_UPP((userRoutine), uppModalFilterProcInfo, (theDialog), (theEvent), (itemHit))
  194. #define CallUserItemProc(userRoutine, theWindow, itemNo)         CALL_TWO_PARAMETER_UPP((userRoutine), uppUserItemProcInfo, (theWindow), (itemNo))
  195.  
  196. /*
  197.     NOTE: Code running under MultiFinder or System 7.0 or newer
  198.     should always pass NULL to InitDialogs.
  199. */
  200. EXTERN_API( void )
  201. InitDialogs                        (void *                    ignored)                            ONEWORDINLINE(0xA97B);
  202.  
  203. EXTERN_API( void )
  204. ErrorSound                        (SoundUPP                 soundProc)                            ONEWORDINLINE(0xA98C);
  205.  
  206. EXTERN_API( DialogPtr )
  207. NewDialog                        (void *                    dStorage,
  208.                                  const Rect *            boundsRect,
  209.                                  ConstStr255Param         title,
  210.                                  Boolean                 visible,
  211.                                  SInt16                 procID,
  212.                                  WindowPtr                 behind,
  213.                                  Boolean                 goAwayFlag,
  214.                                  SInt32                 refCon,
  215.                                  Handle                 items)                                ONEWORDINLINE(0xA97D);
  216.  
  217. EXTERN_API( DialogPtr )
  218. GetNewDialog                    (SInt16                 dialogID,
  219.                                  void *                    dStorage,
  220.                                  WindowPtr                 behind)                                ONEWORDINLINE(0xA97C);
  221.  
  222. EXTERN_API( DialogPtr )
  223. NewColorDialog                    (void *                    dStorage,
  224.                                  const Rect *            boundsRect,
  225.                                  ConstStr255Param         title,
  226.                                  Boolean                 visible,
  227.                                  SInt16                 procID,
  228.                                  WindowPtr                 behind,
  229.                                  Boolean                 goAwayFlag,
  230.                                  SInt32                 refCon,
  231.                                  Handle                 items)                                ONEWORDINLINE(0xAA4B);
  232.  
  233. EXTERN_API( void )
  234. CloseDialog                        (DialogPtr                 theDialog)                            ONEWORDINLINE(0xA982);
  235.  
  236. EXTERN_API( void )
  237. DisposeDialog                    (DialogPtr                 theDialog)                            ONEWORDINLINE(0xA983);
  238.  
  239. EXTERN_API( void )
  240. ModalDialog                        (ModalFilterUPP         modalFilter,
  241.                                  DialogItemIndex *        itemHit)                            ONEWORDINLINE(0xA991);
  242.  
  243. EXTERN_API( Boolean )
  244. IsDialogEvent                    (const EventRecord *    theEvent)                            ONEWORDINLINE(0xA97F);
  245.  
  246. EXTERN_API( Boolean )
  247. DialogSelect                    (const EventRecord *    theEvent,
  248.                                  DialogPtr *            theDialog,
  249.                                  DialogItemIndex *        itemHit)                            ONEWORDINLINE(0xA980);
  250.  
  251. EXTERN_API( void )
  252. DrawDialog                        (DialogPtr                 theDialog)                            ONEWORDINLINE(0xA981);
  253.  
  254. EXTERN_API( void )
  255. UpdateDialog                    (DialogPtr                 theDialog,
  256.                                  RgnHandle                 updateRgn)                            ONEWORDINLINE(0xA978);
  257.  
  258. EXTERN_API( void )
  259. HideDialogItem                    (DialogPtr                 theDialog,
  260.                                  DialogItemIndex         itemNo)                                ONEWORDINLINE(0xA827);
  261.  
  262. EXTERN_API( void )
  263. ShowDialogItem                    (DialogPtr                 theDialog,
  264.                                  DialogItemIndex         itemNo)                                ONEWORDINLINE(0xA828);
  265.  
  266. EXTERN_API( DialogItemIndexZeroBased )
  267. FindDialogItem                    (DialogPtr                 theDialog,
  268.                                  Point                     thePt)                                ONEWORDINLINE(0xA984);
  269.  
  270. EXTERN_API( void )
  271. DialogCut                        (DialogPtr                 theDialog);
  272.  
  273. EXTERN_API( void )
  274. DialogPaste                        (DialogPtr                 theDialog);
  275.  
  276. EXTERN_API( void )
  277. DialogCopy                        (DialogPtr                 theDialog);
  278.  
  279. EXTERN_API( void )
  280. DialogDelete                    (DialogPtr                 theDialog);
  281.  
  282. EXTERN_API( DialogItemIndex )
  283. Alert                            (SInt16                 alertID,
  284.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA985);
  285.  
  286. EXTERN_API( DialogItemIndex )
  287. StopAlert                        (SInt16                 alertID,
  288.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA986);
  289.  
  290. EXTERN_API( DialogItemIndex )
  291. NoteAlert                        (SInt16                 alertID,
  292.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA987);
  293.  
  294. EXTERN_API( DialogItemIndex )
  295. CautionAlert                    (SInt16                 alertID,
  296.                                  ModalFilterUPP         modalFilter)                        ONEWORDINLINE(0xA988);
  297.  
  298. EXTERN_API( void )
  299. GetDialogItem                    (DialogPtr                 theDialog,
  300.                                  DialogItemIndex         itemNo,
  301.                                  DialogItemType *        itemType,
  302.                                  Handle *                item,
  303.                                  Rect *                    box)                                ONEWORDINLINE(0xA98D);
  304.  
  305. EXTERN_API( void )
  306. SetDialogItem                    (DialogPtr                 theDialog,
  307.                                  DialogItemIndex         itemNo,
  308.                                  DialogItemType         itemType,
  309.                                  Handle                 item,
  310.                                  const Rect *            box)                                ONEWORDINLINE(0xA98E);
  311.  
  312. EXTERN_API( void )
  313. ParamText                        (ConstStr255Param         param0,
  314.                                  ConstStr255Param         param1,
  315.                                  ConstStr255Param         param2,
  316.                                  ConstStr255Param         param3)                                ONEWORDINLINE(0xA98B);
  317.  
  318. EXTERN_API( void )
  319. SelectDialogItemText            (DialogPtr                 theDialog,
  320.                                  DialogItemIndex         itemNo,
  321.                                  SInt16                 strtSel,
  322.                                  SInt16                 endSel)                                ONEWORDINLINE(0xA97E);
  323.  
  324. EXTERN_API( void )
  325. GetDialogItemText                (Handle                 item,
  326.                                  Str255                 text)                                ONEWORDINLINE(0xA990);
  327.  
  328. EXTERN_API( void )
  329. SetDialogItemText                (Handle                 item,
  330.                                  ConstStr255Param         text)                                ONEWORDINLINE(0xA98F);
  331.  
  332. EXTERN_API( SInt16 )
  333. GetAlertStage                    (void)                                                        TWOWORDINLINE(0x3EB8, 0x0A9A);
  334.  
  335. EXTERN_API( void )
  336. SetDialogFont                    (SInt16                 value)                                TWOWORDINLINE(0x31DF, 0x0AFA);
  337.  
  338. EXTERN_API( void )
  339. ResetAlertStage                    (void)                                                        TWOWORDINLINE(0x4278, 0x0A9A);
  340.  
  341.  
  342. #if CGLUESUPPORTED
  343. EXTERN_API_C( DialogPtr )
  344. newdialog                        (void *                    dStorage,
  345.                                  const Rect *            boundsRect,
  346.                                  const char *            title,
  347.                                  Boolean                 visible,
  348.                                  SInt16                 procID,
  349.                                  WindowPtr                 behind,
  350.                                  Boolean                 goAwayFlag,
  351.                                  SInt32                 refCon,
  352.                                  Handle                 items);
  353.  
  354. EXTERN_API_C( DialogPtr )
  355. newcolordialog                    (void *                    dStorage,
  356.                                  const Rect *            boundsRect,
  357.                                  const char *            title,
  358.                                  Boolean                 visible,
  359.                                  SInt16                 procID,
  360.                                  WindowPtr                 behind,
  361.                                  Boolean                 goAwayFlag,
  362.                                  SInt32                 refCon,
  363.                                  Handle                 items);
  364.  
  365. EXTERN_API_C( void )
  366. paramtext                        (const char *            param0,
  367.                                  const char *            param1,
  368.                                  const char *            param2,
  369.                                  const char *            param3);
  370.  
  371. EXTERN_API_C( void )
  372. getdialogitemtext                (Handle                 item,
  373.                                  char *                    text);
  374.  
  375. EXTERN_API_C( void )
  376. setdialogitemtext                (Handle                 item,
  377.                                  const char *            text);
  378.  
  379. EXTERN_API_C( DialogItemIndexZeroBased )
  380. finddialogitem                    (DialogPtr                 theDialog,
  381.                                  Point *                thePt);
  382.  
  383. #endif  /* CGLUESUPPORTED */
  384.  
  385. EXTERN_API( void )
  386. AppendDITL                        (DialogPtr                 theDialog,
  387.                                  Handle                 theHandle,
  388.                                  DITLMethod             method);
  389.  
  390. EXTERN_API( DialogItemIndex )
  391. CountDITL                        (DialogPtr                 theDialog);
  392.  
  393. EXTERN_API( void )
  394. ShortenDITL                        (DialogPtr                 theDialog,
  395.                                  DialogItemIndex         numberItems);
  396.  
  397. EXTERN_API( Boolean )
  398. StdFilterProc                    (DialogPtr                 theDialog,
  399.                                  EventRecord *            event,
  400.                                  DialogItemIndex *        itemHit);
  401.  
  402. EXTERN_API( OSErr )
  403. GetStdFilterProc                (ModalFilterUPP *        theProc)                            THREEWORDINLINE(0x303C, 0x0203, 0xAA68);
  404.  
  405. EXTERN_API( OSErr )
  406. SetDialogDefaultItem            (DialogPtr                 theDialog,
  407.                                  DialogItemIndex         newItem)                            THREEWORDINLINE(0x303C, 0x0304, 0xAA68);
  408.  
  409. EXTERN_API( OSErr )
  410. SetDialogCancelItem                (DialogPtr                 theDialog,
  411.                                  DialogItemIndex         newItem)                            THREEWORDINLINE(0x303C, 0x0305, 0xAA68);
  412.  
  413. EXTERN_API( OSErr )
  414. SetDialogTracksCursor            (DialogPtr                 theDialog,
  415.                                  Boolean                 tracks)                                THREEWORDINLINE(0x303C, 0x0306, 0xAA68);
  416.  
  417. #if OLDROUTINENAMES
  418. #define DisposDialog(theDialog) DisposeDialog(theDialog)
  419. #define UpdtDialog(theDialog, updateRgn) UpdateDialog(theDialog, updateRgn)
  420. #define GetDItem(theDialog, itemNo, itemType, item, box) GetDialogItem(theDialog, itemNo, itemType, item, box)
  421. #define SetDItem(theDialog, itemNo, itemType, item, box) SetDialogItem(theDialog, itemNo, itemType, item, box)
  422. #define HideDItem(theDialog, itemNo) HideDialogItem(theDialog, itemNo)
  423. #define ShowDItem(theDialog, itemNo) ShowDialogItem(theDialog, itemNo)
  424. #define SelIText(theDialog, itemNo, strtSel, endSel) SelectDialogItemText(theDialog, itemNo, strtSel, endSel)
  425. #define GetIText(item, text) GetDialogItemText(item, text)
  426. #define SetIText(item, text) SetDialogItemText(item, text)
  427. #define FindDItem(theDialog, thePt) FindDialogItem(theDialog, thePt)
  428. #define NewCDialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items) \
  429. NewColorDialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items)
  430. #define GetAlrtStage() GetAlertStage()
  431. #define ResetAlrtStage() ResetAlertStage()
  432. #define DlgCut(theDialog) DialogCut(theDialog)
  433. #define DlgPaste(theDialog) DialogPaste(theDialog)
  434. #define DlgCopy(theDialog) DialogCopy(theDialog)
  435. #define DlgDelete(theDialog) DialogDelete(theDialog)
  436. #define SetDAFont(fontNum) SetDialogFont(fontNum)
  437. #if CGLUESUPPORTED
  438. #define newcdialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items) \
  439. newcolordialog(dStorage, boundsRect, title, visible, procID, behind, goAwayFlag, refCon, items)
  440. #define getitext(item, text) getdialogitemtext(item, text)
  441. #define setitext(item, text) setdialogitemtext(item, text)
  442. #define findditem(theDialog, thePt) finddialogitem(theDialog, thePt)
  443. #endif  /* CGLUESUPPORTED */
  444.  
  445. #endif  /* OLDROUTINENAMES */
  446.  
  447. /*
  448.     *****************************************************************************
  449.     *                                                                           *
  450.     * The conditional STRICT_DIALOGS has been removed from this interface file. *
  451.     * The accessor macros to a DialogRecord are no longer necessary.            *
  452.     *                                                                           *
  453.     * All ≈Ref Types have reverted to their original Handle and Ptr Types.      *
  454.     *                                                                           *
  455.     *****************************************************************************
  456.  
  457.     Details:
  458.     The original purpose of the STRICT_ conditionals and accessor macros was to
  459.     help ease the transition to Copland.  Shared data structures are difficult
  460.     to coordinate in a preemptive multitasking OS.  By hiding the fields in a
  461.     WindowRecord and other data structures, we would begin the migration to the
  462.     discipline wherein system data structures are completely hidden from
  463.     applications.
  464.     
  465.     After many design reviews, we finally concluded that with this sort of
  466.     migration, the system could never tell when an application was no longer
  467.     peeking at a WindowRecord, and thus the data structure might never become
  468.     system owned.  Additionally, there were many other limitations in the
  469.     classic toolbox that were begging to be addressed.  The final decision was
  470.     to leave the traditional toolbox as a compatibility mode.
  471.     
  472.     We also decided to use the Handle and Ptr based types in the function
  473.     declarations.  For example, NewWindow now returns a WindowPtr rather than a
  474.     WindowRef.  The Ref types are still defined in the header files, so all
  475.     existing code will still compile exactly as it did before.  There are
  476.     several reasons why we chose to do this:
  477.     
  478.     - The importance of backwards compatibility makes it unfeasible for us to
  479.     enforce real opaque references in the implementation anytime in the
  480.     foreseeable future.  Therefore, any opaque data types (e.g. WindowRef,
  481.     ControlRef, etc.) in the documentation and header files would always be a
  482.     fake veneer of opacity.
  483.     
  484.     - There exists a significant base of books and sample code that neophyte
  485.     Macintosh developers use to learn how to program the Macintosh.  These
  486.     books and sample code all use direct data access.  Introducing opaque data
  487.     types at this point would confuse neophyte programmers more than it would
  488.     help them.
  489.     
  490.     - Direct data structure access is used by nearly all Macintosh developers. 
  491.     Changing the interfaces to reflect a false opacity would not provide any
  492.     benefit to these developers.
  493.     
  494.     - Accessor functions are useful in and of themselves as convenience
  495.     functions, without being tied to opaque data types.  We will complete and
  496.     document the Windows and Dialogs accessor functions in an upcoming release
  497.     of the interfaces.
  498. */
  499. #ifdef __cplusplus
  500. inline WindowPtr     GetDialogWindow(DialogPtr dialog)        { return (WindowPtr) dialog;                         }
  501. inline SInt16        GetDialogDefaultItem(DialogPtr dialog)  { return (*(SInt16 *) (((UInt8 *) dialog) + 168));    }
  502. inline SInt16        GetDialogCancelItem(DialogPtr dialog)     { return (*(SInt16 *) (((UInt8 *) dialog) + 166));    }
  503. inline SInt16        GetDialogKeyboardFocusItem(DialogPtr dialog)    { return ((*(SInt16 *) (((UInt8 *) dialog) + 164)) < 0 ? -1 : (*(SInt16 *) (((UInt8 *) dialog) + 164)) + 1); }
  504. inline void        SetGrafPortOfDialog(DialogPtr dialog) { SetPort ((GrafPtr) dialog); }
  505. #else
  506. #define GetDialogWindow(dialog)    ((WindowPtr) dialog)
  507. #define GetDialogDefaultItem(dialog) (*(SInt16 *) (((UInt8 *) dialog) + 168))
  508. #define GetDialogCancelItem(dialog) (*(SInt16 *) (((UInt8 *) dialog) + 166))
  509. #define GetDialogKeyboardFocusItem(dialog) ((*(SInt16 *) (((UInt8 *) dialog) + 164)) < 0 ? -1 : (*(SInt16 *) (((UInt8 *) dialog) + 164)) + 1)
  510. #define SetGrafPortOfDialog(dialog) do { SetPort ((GrafPtr) dialog); } while (false)
  511. #endif
  512.  
  513.  
  514. EXTERN_API( void )
  515. CouldDialog                        (SInt16                 dialogID)                            ONEWORDINLINE(0xA979);
  516.  
  517. EXTERN_API( void )
  518. FreeDialog                        (SInt16                 dialogID)                            ONEWORDINLINE(0xA97A);
  519.  
  520. EXTERN_API( void )
  521. CouldAlert                        (SInt16                 alertID)                            ONEWORDINLINE(0xA989);
  522.  
  523. EXTERN_API( void )
  524. FreeAlert                        (SInt16                 alertID)                            ONEWORDINLINE(0xA98A);
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534. #if PRAGMA_STRUCT_ALIGN
  535.     #pragma options align=reset
  536. #elif PRAGMA_STRUCT_PACKPUSH
  537.     #pragma pack(pop)
  538. #elif PRAGMA_STRUCT_PACK
  539.     #pragma pack()
  540. #endif
  541.  
  542. #ifdef PRAGMA_IMPORT_OFF
  543. #pragma import off
  544. #elif PRAGMA_IMPORT
  545. #pragma import reset
  546. #endif
  547.  
  548. #ifdef __cplusplus
  549. }
  550. #endif
  551.  
  552. #endif /* __DIALOGS__ */
  553.  
  554.